Skip to content

feat(lint): warn when a select option colour renders neutral on the option badge - #37986

Draft
objectstack-fleet[bot] wants to merge 3 commits into
mainfrom
claude/project-thread-ciejge
Draft

objectstack-fleet[bot] wants to merge 3 commits into
mainfrom
claude/project-thread-ciejge

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread
Fixes #37435
Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:搭建者(人或 AI)给下拉选项写了 teal、amber、大写的 Red 这类界面画不出来的颜色时,校验命令和保存时都会收到一条提示,说明这个颜色会显示成灰色、该怎么改;写九个色系名或十六进制色的不受影响。
  • 为什么做:上一张卡已经定下"选项颜色只认作者声明、没配就灰",但写错的颜色也会静默变灰,作者不知道自己写错了。
  • 出错会怎样:只是提示、从不拒绝保存,误报最多多一条警告;平台和示例里现有的选项颜色没有一条会触发,可直接撤回。
  • 要你做的:无。

What changes

  • New advisory rule field/option-color-renders-neutral (lintOptionColors in packages/lint/src/data-model-rules.ts). It warns on a select option color the option badge does not paint: anything that is not one of the nine palette families (gray red orange yellow green blue indigo purple pink, lowercase, as BADGE_COLOR_MAP matches them) and not # + 3 or 6 hex digits. The warning names the option; the fix line names the spelling the value already points at (lowercase family, the hex with its #, the hex without alpha digits), otherwise the families and the hex form. It never maps a colour name to a family.
  • Route (a) as a warning, not (b) a name-to-family map: (b) is consumer-side tolerance that invents a colour the author did not pick, close to the value-derived colour ruling A on Select options with no declared colour: render neutral instead of a semantic-table / hash-assigned colour #36882 removed (「A 全部去掉,没配就灰」). Not a refusal: SelectOption.color stays z.string(), and charts and gantt bars paint a CSS colour name.
  • Registered in AUTHORING_RULES as tier: 'advisory', on os validate / os build / os lint, and on the runtime publish gate for object and object_extension writes, where findings ride back as 2xx advisories (the save door Studio, REST /meta and MCP authors share). Judges object fields, object-extension fields, picklists and picklist extensions; picklists are CLI-only because picklist is not runtime-creatable.
  • os explain field/option-color-renders-neutral entry in rule-explanations.ts, with the measured per-surface reading.
  • Root barrel publishes FIELD_OPTION_COLOR_RENDERS_NEUTRAL, OPTION_COLOR_FAMILIES, isBadgePaintableOptionColor, lintOptionColors, type OptionColorPicklist.
  • Object and object-extension door roster pins gain the rule (three test files), and the four docs CLI transcripts print 87 author-time rules (check:docs-transcript-drift).

Tests

  • New pin packages/lint/src/data-model-rules.option-color-37435.test.ts: teal warned (rule, severity, path, where, fix names all nine families) and amber, Red, bare hex, alpha hex, rgb(), hsl(), leading-space hex all warned; every declared family and #abc / #14b8a6 not warned; blank colour not judged; extension and picklist paths; all three commands; at the save door teal comes back as an advisory with zero errors, and red / a hex with none.

Acceptance notes

  • Door crossing: this is an advisory-tier rule at the object door. The five fenced advisory rules ([P2] 运行时授权门扩到 object 写入 + 全量 runtime-safe 规则快照(#4463 P1 之后) #4716 adjudication, RUNTIME_OBJECT_ADVISORY_VOLUME) stay fenced and untouched; that fence prices advisory VOLUME. Measured volume for this rule: 0 firings. Census of option-level colour literals: objectstack at 6e11ff2 (*.object.ts, picklists, extensions; non-test) is every one a family name or a 6-digit hex; the only out-of-family names (teal, amber, 9 sites) are OBJECT-level color, which this rule does not read. hotcrm at 08a7451: 170 colour literals, all 6-digit hex. The one out-of-family option colour in the tree is a test fixture (ui/e2e/list-condition-row-35549.spec.ts:87, amber).
  • Single source of the family list: @objectstack/lint cannot import @object-ui/fields (lint depends on spec only and runs in the kernel's save door), and a lint test reading the renderer source would need a scripts/cross-package-test-inputs.mjs + turbo.json declaration outside this claim's file surface. The list is therefore spelled once in lint (OPTION_COLOR_FAMILIES) with a comment naming BADGE_COLOR_MAP; the shared home both sides could read is @objectstack/spec, left as an open question in the report rather than taken here.
  • Not judged: a form view's own option list, and an object extension's fieldPatches.
  • The runtime advisory has no localized userMessage (no .user-text.ts catalog); Studio renders the English message.

Verification

  • Two-minute check: pnpm --filter @objectstack/lint exec vitest run src/data-model-rules.option-color-37435.test.ts → 9 passed.
  • Read first: packages/lint/src/data-model-rules.ts (isBadgePaintableOptionColor, must match the renderer's reading), packages/lint/src/authoring-rules.ts (the lintOptionColors entry and its door comment), packages/lint/src/rule-explanations.ts (the per-surface paragraph).
Local readings (HEAD after the docs commit)
  • pnpm --filter @objectstack/lint test → Test Files 244 passed (244), Tests 9816 passed, 5 skipped; pnpm --filter @objectstack/lint typecheck (tsc + test layer) green.
  • Ablation: isBadgePaintableOptionColor forced to true on disk → 5 of 9 pins red (the out-of-family pin included); restored with git checkout HEAD.
  • node scripts/pm/overlap-check.mjs --branch=claude/project-thread-ciejge → VERDICT clean exit 0, feat(spec)!: action locations say what an action acts on #37929 (shares rule-explanations.ts) merges cleanly.
  • Derived gate families run locally; check:dual-build-cjs-loads and check-plugin-teardown-shape --self-test are NOT MEASURED here (no full build; shallow clone) and are left to CI.

Generated by Claude Code

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/lint, touching 16 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/lint/src/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

7 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/metadata-api.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/data-modeling/object-extensions.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/deployment/cli.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/deployment/install-modes.mdx (via picklistExtensions (literal, a string literal in AUTHORING_RULES))
  • content/docs/deployment/validating-metadata.mdx (via AUTHORING_RULES (symbol, a top-level const object), runtimeTypes (symbol, a field of const object AUTHORING_RULES), object_extension (literal, a string literal in runtimeTypes))
  • content/docs/kernel/cluster.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/ui/actions.mdx (via object_extension (literal, a string literal in runtimeTypes))

⛔ 6 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-6.mdx (via picklistExtensions (literal, a string literal in AUTHORING_RULES))
  • content/docs/releases/v18/18-3.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/releases/v18/18-4.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/releases/v18/18-5.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/releases/v18/18-6.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/releases/v19/index.mdx (via object_extension (literal, a string literal in runtimeTypes))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/lint/src/index.ts) — pages documenting those are invisible to this run
  • 7 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 4 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 57ab08760c7ffd506454864b22c0ce7d9a614164 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 6ae06014813bce6f40572551a0486239cda05d39 — the merge of head e3423ab81d3143b1c6c804fcfff8c8c277b73dda into base 57ab08760c7ffd506454864b22c0ce7d9a614164, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 6ae06014813bce6f40572551a0486239cda05d39 && git checkout 6ae06014813bce6f40572551a0486239cda05d39
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 57ab08760c7ffd506454864b22c0ce7d9a614164 e3423ab81d3143b1c6c804fcfff8c8c277b73dda && git checkout -B drift-repro 57ab08760c7ffd506454864b22c0ce7d9a614164 && git merge --no-ff e3423ab81d3143b1c6c804fcfff8c8c277b73dda

node scripts/docs-audit/affected-docs.mjs --json 57ab08760c7ffd506454864b22c0ce7d9a614164

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 57ab08760c7ffd506454864b22c0ce7d9a614164 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants